//
//  JLSettingTableViewController.m
//  JL网易彩票progress
//
//  Created by sunjinliang on 15/11/9.
//  Copyright © 2015年 sunjinliang. All rights reserved.
//

#import "JLSettingTableViewController.h"
#import "JLSettingitem.h"
#import "JLSettingLabelitem.h"
#import "JLSettingSwitchitem.h"
#import "JLSettingArrowitem.h"
#import "JLTableViewCell.h"
#import "JLPushViewController.h"
#import "JLShareTableViewController.h"
#import "JLAboutViewController.h"
#import "JLProductCollectionViewController.h"
@interface JLSettingTableViewController ()

@end

@implementation JLSettingTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"设置";

    [self addGroup0];
    [self addGroup1];
    [self addGroup2];
}
//懒加载

-(void)addGroup0{
    JLSettingArrowitem *redeemCode=[JLSettingArrowitem itemWithIcon:@"RedeemCode" title:@"使用兑换码"];
    
    [self.setArray addObject:@[redeemCode]];
    
    
}
- (void)addGroup1
{
    JLSettingArrowitem *morePush = [JLSettingArrowitem itemWithIcon:@"MorePush" title:@"推送和提醒"];
    JLSettingSwitchitem *homeshake=[JLSettingSwitchitem itemWithIcon:@"more_homeshake" title:@"使用摇一摇机选"];
    
    homeshake.open = NO;
    __weak typeof(self) weakSelf=self;
    __weak typeof(morePush) WeakMorePush=morePush;
    WeakMorePush.option=^{
        JLPushViewController * pushVc=[[JLPushViewController alloc]init];
        pushVc.title=WeakMorePush.title;
        [weakSelf.navigationController pushViewController:pushVc animated:YES];
        
        
    };
    
    JLSettingSwitchitem *sound = [JLSettingSwitchitem itemWithIcon:@"sound_Effect" title:@"声音效果"];
    JLSettingSwitchitem *recommend = [JLSettingSwitchitem itemWithIcon:@"More_LotteryRecommend" title:@"购彩小助手" ];
    [self.setArray addObject:@[morePush,homeshake,sound,recommend]];
    
}

- (void)addGroup2
{
    JLSettingArrowitem *update = [JLSettingArrowitem itemWithIcon:@"MoreUpdate" title:@"检查新版本"];
    update.option=^{
        [[[UIAlertView alloc]initWithTitle:@"检查新版本" message:@"您已经是最新版本" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]show];
    };
    
    JLSettingArrowitem *share = [JLSettingArrowitem itemWithIcon:@"MoreShare" title:@"分享"];
    __weak typeof(self) weakSelf=self;
    __weak typeof(share) weakShare=share;
    weakShare.option=^{
        JLShareTableViewController * shareVc=[[JLShareTableViewController alloc]init];
        shareVc.title=share.title;
        [weakSelf.navigationController pushViewController:shareVc animated:YES];
    };
    
    JLSettingArrowitem *netsease = [JLSettingArrowitem itemWithIcon:@"MoreNetease" title:@"产品推荐"];
    __weak typeof(netsease) weakNetsease=netsease;
    weakNetsease.option=^{
        
        JLProductCollectionViewController * productVc=[[JLProductCollectionViewController alloc]init];
        productVc.title=weakNetsease.title;
        [weakSelf.navigationController pushViewController:productVc animated:YES];
        
        
    };
    
    JLSettingArrowitem *about = [JLSettingArrowitem itemWithIcon:@"MoreAbout" title:@"关于"];
    __weak  typeof(about)weakAbout=about;
    weakAbout.option=^{
        JLAboutViewController * aboutVc=[[JLAboutViewController alloc]init];
        aboutVc.title=about.title;
        [weakSelf.navigationController pushViewController:aboutVc animated:YES];
    
    };
    
    [self.setArray addObject:@[update,share,netsease,about]];
    
}


@end
